import { post, fetch } from '../../axios/http'

export default {
    getOrgAndDeptList(){
        return new Promise((resolve, reject) => {
            post('/app-sys/orgTree/getBackendOrgAndDeptTree?app_name=app-backend')
                .then(res => {
                    resolve(res);
                })
                .catch(error => {
                    console.log(error);
                });
        });
    },
    getUserListByDeptId(id){
        return new Promise((resolve, reject) => {
            post('/app-sys/orgTree/getBackendUserTreeByDeptId?app_name=app-backend&id='+ id)
                .then(res => {
                    resolve(res);
                })
                .catch(error => {
                    console.log(error);
                });
        });
    },
    getUserListByKey(key){
        return new Promise((resolve, reject) => {
            post('/app-sys/orgTree/getBackendUserTreeByNameSpl?app_name=app-backend&keyWord='+ key)
                .then(res => {
                    resolve(res);
                })
                .catch(error => {
                    console.log(error);
                });
        });
    }
}